/**
 * @author David Young
 */
package csab.tests.visual;

import org.newdawn.slick.Animation;
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.util.Log;

import csab.core.ResourceManager;

/**
 * This class is used to test the ResourceManager class.
 * @author David Young
 * @see csab.core.ResourceManager
 */
public class ResourceManagerTest extends BasicGame {
	private ResourceManager manager;
	private Animation testanim;
	
	/**
	 * The entry point for the test.
	 * @param args Not parsed so any parameters are ignored.
	 */
	public static void main(String[] args) throws SlickException {
		AppGameContainer gc = new AppGameContainer(new ResourceManagerTest());
		gc.setDisplayMode(800, 600, false);
		gc.start();
	}

	/**
	 * This is the default constructor for this test. 
	 * Takes no parameters.
	 */
	public ResourceManagerTest() {
		super("Resource Manager Test");
	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
	 */
	@Override
	public void init(GameContainer arg0) throws SlickException {
		try {
			manager = ResourceManager.getManager("resource/test/test.xml");
		}
		catch(Exception e)
		{
			Log.error(e.getMessage());
			System.exit(-1);
		}
		
		testanim = manager.getAnimation("player_left_walk");
	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
	 */
	@Override
	public void render(GameContainer arg0, Graphics arg1) throws SlickException {
		testanim.draw(0, 0);
	}

	/* (non-Javadoc)
	 * @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int)
	 */
	@Override
	public void update(GameContainer arg0, int arg1) throws SlickException {
		
	}

}
